package com.another.bidservice.utils.task;

import com.another.bidservice.entity.TUser;
import com.another.common.utils.common.MyException;
import com.another.bidservice.dao.jpa.UserJPADao;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @ Author      ：another.
 * @ Create Time ：17:31 2019/9/23
 * @ Description ：
 */

@Component
public class SchedulerTask {

    private Logger logger =  LoggerFactory.getLogger(this.getClass());

    private int count=0;

    @Autowired
    private UserJPADao userJPADao;



//    @Scheduled(cron="*/5 * * * * ? ")
    private void process(){
        System.out.println("this is scheduler task runing  "+(count++));

        try {
            TUser user = new TUser();
            user.setUserId("AAAAAAAA");

//            userJPADao.save(user);

            String s = null;
            s.toString();
        } catch (Exception e) {
            e.printStackTrace();
            logger.info(e.getMessage(), e);
            throw new MyException("添加用户失败");
        }

        logger.info("定时任务执行完毕");

        System.out.println("\n\n\n\n");

    }
}
